var beanstalkc = require('./beanstalk_client');

var server = '192.168.1.10:11300'


beanstalkc.connect(server, function(err, conn) {
	if(err){
		console.log(`connect error ${err}`)
		return;
	}
	var onReserve = function(err, job_id, job_json){
		if(err){
			console.log(`reserve error ${err}`);
			conn.reserve(onReserve)
			return
		}
		
		conn.reply(job_id,job_json,function(err){
			console.log(`replied:${job_id} ${job_json}`);
			conn.reserve(onReserve)
		});
	}
	conn.reserve(onReserve);
});
